
# 手机的唯一标识 包名：com.tal.kaoyan
# 活动：com.tal.kaoyan.ui.activity.SplashActivity

from appium import webdriver
i = 1
while i <= 3:
    print(f'第{i}次安装')
    jw_capabilities = {
        'platformName': 'Android',
        'platformVersion': '9',
        'deviceName':'127.0.0.1:10027',
        'app':'/home/appium/apps/kaoyan3.1.0.apk',
        'appPackage':'com.tal.kaoyan',
        'appActivity':'com.tal.kaoyan.ui.activity.SplashActivity',
        'noReset':False
    }
    jwdriver = webdriver.Remote("http://localhost:4723/wd/hub",jw_capabilities)

    if jwdriver.is_app_installed('com.tal.kaoyan') ==True:
        print('安装成功！')
    else:
        print('安装失败！')

    print('准备卸载App')
    jwdriver.remove_app('com.tal.kaoyan')
    print('卸载完毕!')
    i += 1